<?php
/**
 * Created by PhpStorm.
 * User: 84071
 * Date: 2018-08-15
 * Time: 20:56
 */
namespace app\member\controller;

use app\common\controller\MemberBase;
use app\common\model\UserAddress as cxModel;

class UserAddress extends MemberBase {

    public function index(){
        $cxmodel = new cxModel();
        $userres = $cxmodel->where('uid',$this->cxbsuser['uid'])->where('status','1')->select();
        $this->assign([
            'userres'=>$userres,
        ]);
        return view($this->temp.'user_addreslist.htm');
    }
    public function add(){

        return view($this->temp.'user_addresadd.htm');
    }
    public function edit(){
        $getdata = request()->param();
        $getdata = datatrim($getdata);
        $cxmodel = new cxModel();
        $getdata['f'] = 'find';
        $edit = $cxmodel->one_addres($getdata);
        $this->assign('address',$edit);
        return view($this->temp.'user_addresadd.htm');
    }
    public function see(){
        if(request()->isPost()){
            $id = input('cxbsid');
            $cxmodel = new cxModel();
            $status = $cxmodel->where('id',$id)->find();
            if($status['status'] == '1'){
                $cxmodel->where('id',$status['id'])->update(['status' => '0']);
                $this->success("删除成功");
            }else{
                $cxmodel->where('id',$status['id'])->update(['status' => '1']);
                $this->success("找回成功");
            }
        }
    }


}